package com.d1708.zhanggm.springcloud.jpa.common;

import org.springframework.context.annotation.Primary;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 软删除的枚举类
 */
public enum DeleteEnum {
    YES(1),NO(0);

    private Integer value;

    DeleteEnum(Integer value) {
        this.value = value;
    }

    /**
     * 封装枚举类成List，Controller调用该静态方法，返回给前端。
     * @return
     */
    public static List<Map<String,Object>> getDeleteList(){
        List<Map<String,Object>> delTypeList = new ArrayList<>();
        DeleteEnum[] values = DeleteEnum.values();
        for (DeleteEnum deleteEnum : values){
            Map<String,Object> delMap = new HashMap<>();
            delMap.put("id",deleteEnum.ordinal());
            delMap.put("name",deleteEnum.name());
            delTypeList.add(delMap);
        }
        return delTypeList;
    }


}
